
macro ParseBuildLog()
{
	hWnd = GetCurrentWnd()
	hBuf = GetCurrentBuf()

	if( (hNil==hWnd) || (hNil==hBuf) || (buildLogFile=='"') )
	{
		return
	}

	buildLogFile=GetBufName (hBuf)
	if(""!=buildLogFile){
		if(True == IsBufDirty(hBuf)){
			answ=Ask("Reload @buildLogFile@ without saving? Y/N")
			if( ("y"==answ) || ("Y"==answ) ){
				Reload_File()
			}
		}
		else{
			Reload_File()
		}
	}

	bufSch=NewBuf("")

//	pattenFile="[^\\s\\t(\\\\/]+"
	pattenFile="[^\\s\\t(/]+"
	pattenLine="[0-9]+"
	pattern="\\(@pattenFile@\\)(\\(@pattenLine@\\))"
//DbgMsg("pattern", pattern)		
	
	lnSch=0
	while(1){
		ClearBuf(bufSch)
		selRst=SearchInBufEx (hBuf, pattern, lnSch, 0, 1, 1, 0, bufSch, 0)
		if(""==selRst){
			break
		}

		linkFile=GetBufLine(bufSch, 1)
		linkLine=GetBufLine(bufSch, 2)
		linkLine=linkLine-1
//DbgMsg("linkFile", linkFile)		
//DbgMsg("linkLine", linkLine)		
		SetSourceLink (hBuf, selRst.lnFirst, linkFile, linkLine)

		lnSch=selRst.lnLast+1
	}

	//error LNKXXXX: unresolved external symbol XXXX
	//error LNKXXXX: unresolved external symbol ParseBuildLog
	//error LNK.*symbol \([^\s]+\)
	pattern="error LNK.*symbol \\([^\\s]+\\)"
//DbgMsg("pattern", pattern)		
	lnSch=0
	while(1)	{
		ClearBuf(bufSch)
		selRst=SearchInBufEx (hBuf, pattern, lnSch, 0, 1, 1, 0, bufSch, 1)
		if(""==selRst){
			break
		}

		symb=GetBufLine(bufSch, 1)
		symbrec=GetSymbolLocation( symb)
		if( ""!=symbrec){
			SetSourceLink (hBuf, selRst.lnFirst, symbrec.File, symbrec.lnName)
		}
		
		lnSch=selRst.lnLast+1
	}
	
	CloseBuf(bufSch)

	MaximizeWnd (hWnd)
	SetCurrentWnd (hWnd)
}

/*
//d:\\tmp\\build.log(5) asdfasdfasd
ParseBuildLog.em(3) asdfasdfasd
d:\tmp\build.log(1) asdfasdfasd
*/

